package cn.tedu.personnel.controller;

import cn.tedu.base.response.JsonResult;
import cn.tedu.personnel.pojo.dto.UserParam;
import cn.tedu.personnel.pojo.dto.UserQuery;
import cn.tedu.personnel.pojo.entity.User;
import cn.tedu.personnel.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/v1/personnel")
public class UserController {
    @Autowired
    private UserService userService;

    @GetMapping("select")
    public JsonResult select(UserQuery userQuery){
        List<User> users = userService.select(userQuery);
        log.debug("查找人事流程参数：{}",userQuery);
        return JsonResult.ok(users);
    }

    @PostMapping("insert")
    public JsonResult insert(@RequestBody UserParam userParam){
        log.debug("新增人事流程参数：{}",userParam);
        userService.insert(userParam);
        return JsonResult.ok();
    }

}
